home *** CD-ROM | disk | FTP | other *** search
/ Champak 147 / (Vol 147) Jan 21 2012.iso / Interface / mod.000 / scripts / __Packages / mx / managers / OverlappedWindows.as < prev    next >
Text File  |  2012-01-21  |  7KB  |  192 lines

  1. class mx.managers.OverlappedWindows
  2. {
  3.    static var initialized = false;
  4.    static var SystemManagerDependency = mx.managers.SystemManager;
  5.    function OverlappedWindows()
  6.    {
  7.    }
  8.    static function checkIdle(Void)
  9.    {
  10.       if(mx.managers.SystemManager.idleFrames > 10)
  11.       {
  12.          mx.managers.SystemManager.dispatchEvent({type:"idle"});
  13.       }
  14.       else
  15.       {
  16.          mx.managers.SystemManager.idleFrames = mx.managers.SystemManager.idleFrames + 1;
  17.       }
  18.    }
  19.    static function __addEventListener(e, o, l)
  20.    {
  21.       if(e == "idle")
  22.       {
  23.          if(mx.managers.SystemManager.interval == undefined)
  24.          {
  25.             mx.managers.SystemManager.interval = setInterval(mx.managers.SystemManager.checkIdle,100);
  26.          }
  27.       }
  28.       mx.managers.SystemManager._xAddEventListener(e,o,l);
  29.    }
  30.    static function __removeEventListener(e, o, l)
  31.    {
  32.       if(e == "idle")
  33.       {
  34.          if(mx.managers.SystemManager._xRemoveEventListener(e,o,l) == 0)
  35.          {
  36.             clearInterval(mx.managers.SystemManager.interval);
  37.          }
  38.       }
  39.       else
  40.       {
  41.          mx.managers.SystemManager._xRemoveEventListener(e,o,l);
  42.       }
  43.    }
  44.    static function onMouseDown(Void)
  45.    {
  46.       mx.managers.SystemManager.idleFrames = 0;
  47.       mx.managers.SystemManager.isMouseDown = true;
  48.       var _loc5_ = _root;
  49.       var _loc3_ = undefined;
  50.       var _loc8_ = _root._xmouse;
  51.       var _loc7_ = _root._ymouse;
  52.       if(mx.managers.SystemManager.form.modalWindow == undefined)
  53.       {
  54.          if(mx.managers.SystemManager.forms.length > 1)
  55.          {
  56.             var _loc6_ = mx.managers.SystemManager.forms.length;
  57.             var _loc4_ = undefined;
  58.             _loc4_ = 0;
  59.             while(_loc4_ < _loc6_)
  60.             {
  61.                var _loc2_ = mx.managers.SystemManager.forms[_loc4_];
  62.                if(_loc2_._visible)
  63.                {
  64.                   if(_loc2_.hitTest(_loc8_,_loc7_))
  65.                   {
  66.                      if(_loc3_ == undefined)
  67.                      {
  68.                         _loc3_ = _loc2_.getDepth();
  69.                         _loc5_ = _loc2_;
  70.                      }
  71.                      else if(_loc3_ < _loc2_.getDepth())
  72.                      {
  73.                         _loc3_ = _loc2_.getDepth();
  74.                         _loc5_ = _loc2_;
  75.                      }
  76.                   }
  77.                }
  78.                _loc4_ = _loc4_ + 1;
  79.             }
  80.             if(_loc5_ != mx.managers.SystemManager.form)
  81.             {
  82.                mx.managers.SystemManager.activate(_loc5_);
  83.             }
  84.          }
  85.       }
  86.       var _loc9_ = mx.managers.SystemManager.form;
  87.       _loc9_.focusManager._onMouseDown();
  88.    }
  89.    static function onMouseMove(Void)
  90.    {
  91.       mx.managers.SystemManager.idleFrames = 0;
  92.    }
  93.    static function onMouseUp(Void)
  94.    {
  95.       mx.managers.SystemManager.isMouseDown = false;
  96.       mx.managers.SystemManager.idleFrames = 0;
  97.    }
  98.    static function activate(f)
  99.    {
  100.       if(mx.managers.SystemManager.form != undefined)
  101.       {
  102.          if(mx.managers.SystemManager.form != f && mx.managers.SystemManager.forms.length > 1)
  103.          {
  104.             var _loc1_ = mx.managers.SystemManager.form;
  105.             _loc1_.focusManager.deactivate();
  106.          }
  107.       }
  108.       mx.managers.SystemManager.form = f;
  109.       f.focusManager.activate();
  110.    }
  111.    static function deactivate(f)
  112.    {
  113.       if(mx.managers.SystemManager.form != undefined)
  114.       {
  115.          if(mx.managers.SystemManager.form == f && mx.managers.SystemManager.forms.length > 1)
  116.          {
  117.             var _loc5_ = mx.managers.SystemManager.form;
  118.             _loc5_.focusManager.deactivate();
  119.             var _loc3_ = mx.managers.SystemManager.forms.length;
  120.             var _loc1_ = undefined;
  121.             var _loc2_ = undefined;
  122.             _loc1_ = 0;
  123.             while(_loc1_ < _loc3_)
  124.             {
  125.                if(mx.managers.SystemManager.forms[_loc1_] == f)
  126.                {
  127.                   _loc1_ += 1;
  128.                   while(_loc1_ < _loc3_)
  129.                   {
  130.                      if(mx.managers.SystemManager.forms[_loc1_]._visible == true)
  131.                      {
  132.                         _loc2_ = mx.managers.SystemManager.forms[_loc1_];
  133.                      }
  134.                      _loc1_ = _loc1_ + 1;
  135.                   }
  136.                   mx.managers.SystemManager.form = _loc2_;
  137.                   break;
  138.                }
  139.                if(mx.managers.SystemManager.forms[_loc1_]._visible == true)
  140.                {
  141.                   _loc2_ = mx.managers.SystemManager.forms[_loc1_];
  142.                }
  143.                _loc1_ = _loc1_ + 1;
  144.             }
  145.             _loc5_ = mx.managers.SystemManager.form;
  146.             _loc5_.focusManager.activate();
  147.          }
  148.       }
  149.    }
  150.    static function addFocusManager(f)
  151.    {
  152.       mx.managers.SystemManager.forms.push(f);
  153.       mx.managers.SystemManager.activate(f);
  154.    }
  155.    static function removeFocusManager(f)
  156.    {
  157.       var _loc3_ = mx.managers.SystemManager.forms.length;
  158.       var _loc1_ = undefined;
  159.       _loc1_ = 0;
  160.       while(_loc1_ < _loc3_)
  161.       {
  162.          if(mx.managers.SystemManager.forms[_loc1_] == f)
  163.          {
  164.             if(mx.managers.SystemManager.form == f)
  165.             {
  166.                mx.managers.SystemManager.deactivate(f);
  167.             }
  168.             mx.managers.SystemManager.forms.splice(_loc1_,1);
  169.             return undefined;
  170.          }
  171.          _loc1_ = _loc1_ + 1;
  172.       }
  173.    }
  174.    static function enableOverlappedWindows()
  175.    {
  176.       if(!mx.managers.OverlappedWindows.initialized)
  177.       {
  178.          mx.managers.OverlappedWindows.initialized = true;
  179.          mx.managers.SystemManager.checkIdle = mx.managers.OverlappedWindows.checkIdle;
  180.          mx.managers.SystemManager.__addEventListener = mx.managers.OverlappedWindows.__addEventListener;
  181.          mx.managers.SystemManager.__removeEventListener = mx.managers.OverlappedWindows.__removeEventListener;
  182.          mx.managers.SystemManager.onMouseDown = mx.managers.OverlappedWindows.onMouseDown;
  183.          mx.managers.SystemManager.onMouseMove = mx.managers.OverlappedWindows.onMouseMove;
  184.          mx.managers.SystemManager.onMouseUp = mx.managers.OverlappedWindows.onMouseUp;
  185.          mx.managers.SystemManager.activate = mx.managers.OverlappedWindows.activate;
  186.          mx.managers.SystemManager.deactivate = mx.managers.OverlappedWindows.deactivate;
  187.          mx.managers.SystemManager.addFocusManager = mx.managers.OverlappedWindows.addFocusManager;
  188.          mx.managers.SystemManager.removeFocusManager = mx.managers.OverlappedWindows.removeFocusManager;
  189.       }
  190.    }
  191. }
  192.